# Maintainer: Patrick Gansterer <paroga@paroga.com>
pkgname=postgresql-uint
_pkgname=pguint
pkgver=1.20220601
pkgrel=1
pkgdesc="Unsigned and other extra integer types for PostgreSQL"
url="https://github.com/petere/pguint"
arch="all"
license="PostgreSQL"
makedepends="postgresql-dev python3"
subpackages="$pkgname-bitcode"
source="$pkgname-$pkgver.tar.gz::https://github.com/petere/pguint/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"
options="!check"  # XXX: installcheck requires running PostgreSQL

build() {
	make
}

package() {
	depends="postgresql$(pg_config --major-version)"

	make DESTDIR="$pkgdir" install
}

bitcode() {
	pkgdesc="$pkgdesc (bitcode for JIT)"
	depends="$pkgname=$pkgver-r$pkgrel"
	install_if="postgresql$(pg_config --major-version)-jit $pkgname=$pkgver-r$pkgrel"

	amove usr/lib/postgresql*/bitcode
}

sha512sums="
5ffb7b62e0427ba025f1368930e8ebd6b616fec2d6498b5e9988ea24cc73cca05c47f58b6720750bad84bb030cb25c1911fe5a139718d8f072fef32ac16eecf0  postgresql-uint-1.20220601.tar.gz
"
